package model

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(100)" json:"username"`
	Password string `gorm:"type:varchar(255)" json:"password"`
	Tel      string `gorm:"type:varchar(255)" json:"tel"`
}

type Store struct {
	gorm.Model
	UserID  int64   `gorm:"type:int"`
	Name    string  `gorm:"type:varchar(100)"`
	Address string  `gorm:"type:varchar(255)"`
	Phone   string  `gorm:"type:varchar(255)"`
	Price   float64 `gorm:"type:decimal(10,2)"`
	Image   string  `gorm:"type:varchar(255)"`
}
type Good struct {
	gorm.Model
	StoreID int64   `gorm:"type:int"`
	Name    string  `gorm:"type:varchar(100)"`
	Price   float64 `gorm:"type:decimal(10,2)"`
	Stock   int     `gorm:"type:int"`
	Img     string  `gorm:"type:varchar(255)"`
	Total   float64 `gorm:"type:decimal(10,2)"`
}

func (s *Store) StoreCreate(db *gorm.DB) error {
	return db.Create(&s).Error
}

func (g *Good) GoodCreate(db *gorm.DB) error {
	return db.Create(&g).Error
}
